package com.eedi.framework.config.controller.sys;

import com.eedi.framework.config.controller.sys.vo.sensitive.SensitiveCfgResp;
import com.eedi.framework.config.service.HospitalConfigService;
import com.eedi.framework.common.pojo.CommonResult;
import com.eedi.framework.config.controller.sys.vo.sensitive.SensitiveCfgReq;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

import static com.eedi.framework.common.pojo.CommonResult.success;


/**
 * @author zybourn
 * @version 1.0
 * @description
 * @since 2024/3/13 19:22
 **/

//@Tag(name = "系统界面 - 敏感数据配置管理")
//@RestController
//@RequestMapping("/sensitive-cfg")
//@Validated
public class SensitiveConfigController {

    @Resource
    private HospitalConfigService hospitalConfigService;
    /**
     * 保存敏感数据配置
     * @param sensitiveCfgReq 敏感信息
     * @return
     */
    @PostMapping("/save")
    public CommonResult<Boolean> saveSensitiveConfig(@RequestBody @Validated SensitiveCfgReq sensitiveCfgReq) {
        hospitalConfigService.addOrUpdateSensitiveCfg(sensitiveCfgReq);
        return success(true);
    }


    /**
     * 查询所有敏感数据配置
     * @return
     */
    @GetMapping("/get")
    public CommonResult<SensitiveCfgResp> getSensitiveMerchantConfig() {
        return success(hospitalConfigService.getSensitiveCfg());
    }
}
